/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projetointegrado;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

/**
 *
 * @author Rogerio
 */
public class JanelaJogo extends JPanel{
    
  KeyboardInput keyboard = new KeyboardInput();
  final int WIDTH = 830;
  final int HEIGHT = 600;
  private BufferedImage char_male; 
  private String positionChar;
  Player player = ProjetoIntegrado.player;
  Canvas canvas= new Canvas(); 
  String bloco = "";
  Movement m = new Movement(player,keyboard,WIDTH,HEIGHT);
  
  
  public int getWidth(){
      return WIDTH;
  }
  public int getHeight(){
      return HEIGHT;
  }
   
 public JanelaJogo(String s) {
    this.bloco = s;
    setIgnoreRepaint( true );
    setBounds(0,-5,WIDTH,0);
    canvas.setIgnoreRepaint( true );
    canvas.setSize( WIDTH, HEIGHT );
    add(canvas);
    addKeyListener(keyboard);
    canvas.addKeyListener(keyboard);
    System.out.println("ADDED KEYLISTENER");
    
  }
 
 public JanelaJogo(String s, Player p){
     this.bloco = s;
     setIgnoreRepaint( true );
    setBounds(0,-5,WIDTH,0);
    canvas.setIgnoreRepaint( true );
    canvas.setSize( WIDTH, HEIGHT );
    add(canvas);
    addKeyListener(keyboard);
    canvas.addKeyListener(keyboard);
    System.out.println("ADDED KEYLISTENER");
    player = p;
 }
    
 public void setBloco(String s){
     bloco = s;
 }
 
 public String getBloco(){
     return bloco;
 }
 
 public DesenhaTela criaDesenhaTela(){
    
     Opcoes opcoes = new Opcoes();
     opcoes.setBounds(200, 200, 500, 400);
     opcoes.setVisible(false);
     add(opcoes);
     DesenhaTela dt = new DesenhaTela(this,canvas,player,WIDTH,HEIGHT,char_male,keyboard,m,bloco);
     dt.start();
     return dt;
 }
    
}
